home *** CD-ROM | disk | FTP | other *** search
- //
- // Generic Movement AI file
- //
- // Behaviors:
- //
- // Path to a location.
- //
- // Notes:
- //
- // Common modifications:
- //
- // To test a trigger at each waypoint, place a GetNextMoveWaypoint transition specification before
- // including this file.
- // To test a trigger at every movement step, place an Advance transition specification before
- // including this file. BEWARE: this trigger will potentially be tested MANY times a second.
- //
- // Known Problems:
- //
- // Usage:
- //
- // To tell a unit to move to a location, give it a location goal (EEUGLocation) and set it's action
- // to keeuaPrepareToMove.
- //
-
- // is pathfinding complete?
- PrepareToMove
- {
- allof(GoalIsLoadContainer,ContainerInRange) true(WaitForTransport)
- NoMoreWaypoints true(TurnToUnitFacing)
- MovePreparationComplete true(LookForEnemies)
- }
-
- // are we at a waypoint?
- Advance
- {
- ArrivedAtMoveWaypoint true(GetNextMoveWaypoint)
- ObstacleDetected true(RepathAroundObstacle)
- allof(OneWaypointRemaining,GoalIsUnit) true(ReacquireEnemyUnit)
- NoMoreWaypoints true(TurnToUnitFacing)
- }
-
- RepathAroundObstacle
- {
- MovePreparationComplete true(Advance) false(ShouldIReturnToInitialContactLocation)
- }
-
- // gets the next location
- GetNextAutoWaypoint
- {
- UnitHasGoal true(PrepareToMove) false(ShouldIReturnToInitialContactLocation)
- }
-
- // look for new waypoints and detect the end of the path
- GetNextMoveWaypoint
- {
- allof(GoalIsLoadContainer,NextWaypointRetrieved) true(GetContainerProgress)
- ShouldMoveToNextAutoWaypoint true(GetNextAutoWaypoint)
- NextWaypointRetrieved true(LookForEnemies) false(TurnToUnitFacing)
- }
-
- // turn to unit facing as specified in the location goal, if required
- TurnToUnitFacing
- {
- GoalIsLoadContainer true(GetContainerProgress)
- anyof(UnitFacingNotRequired,CompletedUnitFacing) true(ReacquireGoal)
- UnitHasGoal false(ReacquireGoal)
- JustStandingThere true(ReacquireGoal)
- }
-
- // should i return to the initial contact location?
- ShouldIReturnToInitialContactLocation
- {
- allof(HasValidInitialContactLocation,ReturnsToInitialContactLocation,GoalIsNotPlayerInitiated) true(ReturnToInitialContactLocation) false(Idle)
- }
-
- // triggers unit to return back to it's initial contact location
- ReturnToInitialContactLocation
- {
- AlwaysTrue true(PrepareToMove)
- }
-
- // the order of these two specifications is important, since the false case of the second one can only be done once
- LookForEnemies
- {
- allof(CanITargetEnemies,GoalIsPatrol,EnemyUnitSpotted) true(CheckRange)
- allof(GoalIsLocation,AttackMoveEnabled,EnemyUnitSpotted) true(CheckRange)
- allof(CanITargetEnemies,GoalIsNotPlayerInitiated,GoalIsNotAttack,EnemyUnitSpotted) true(CheckRange) false(Advance)
- }
-
- // we've reached the end of the path
- // if no goals, ShouldIReturnToInitialContactLocation will figure out what to do
- ReacquireGoal
- {
- GoalIsLocation true(Idle)
- GoalIsExplore true(FindUnexploredArea)
- GoalIsLoadContainer true(ReacquireLoadContainer)
- UnitHasGoal false(ShouldIReturnToInitialContactLocation)
- }
-
- // just for transport/garrison loading
- ReacquireLoadContainer
- {
- ContainerInRange true(WaitForTransport) false(PrepareToMove)
- }
-
- FindUnexploredArea
- {
- SearchingForAreaToExplore true(FindUnexploredArea)
- NoUnexploredAreasLeft true(Idle) false(PrepareToMove)
- }
-
- // for passengers only - assumption is that unit is a passenger
- LoadIntoContainer
- {
- LoadableUnitLoaded true(Idle)
- }
-
- // for passengers only - assumption is that unit is a passenger - order is important
- GetContainerProgress
- {
- ContainerIsDead true(Idle)
- ContainerHasLostGoal true(Idle)
- ContainerInRange true(LoadIntoContainer)
- allof(GoalIsLoadContainer,NoMoreWaypoints,HaveNotReachedRendezvousPoint) true(PrepareToMove)
- allof(GoalIsLoadContainer,NoMoreWaypoints,HaveReachedRendezvousPoint) true(WaitForTransport)
- NoMoreWaypoints true(PrepareToMove) false(Advance)
- }
-
- WaitForTransport
- {
- ContainerIsDead true(Idle)
- ContainerHasLostGoal true(Idle)
- ContainerInRange true(LoadIntoContainer)
- allof(NoMoreWaypoints,ContainerHasNoMoreWaypoints) true(CannotReachContainer)
- }
-
- CannotReachContainer
- {
- AlwaysTrue true(PrepareToMove)
- }